package com.vcc.service.client.vo.walletDetail;

import com.vcc.core.util.DateUtil;
import com.vcc.data.entity.Currency;
import com.vcc.data.entity.WalletDetail;
import com.vcc.service.client.vo.baseVo.BaseVo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;

@EqualsAndHashCode(callSuper = true)
@Data
@Setter
@Getter
public class WalletDetailVo extends BaseVo implements Serializable {

    private String orderId;
    private String cardNumber;
    private Integer useFlag;
    private String remark;
    private BigDecimal amount;
    private BigDecimal walletAmount;

    private Long currencyId;
    private String currencyName;
    private String currencyCode;

    private Long userId;
    private String account;
    private Long operationUserId;
    private String operationUserAccount;
    private String requestDate;
    private Boolean hasTransferIn;

    public WalletDetailVo() {
    }

    public WalletDetailVo(WalletDetail walletDetail, String account, String operationUserAccount, Currency currency) {
        super.setId(walletDetail.getId());
        this.orderId = walletDetail.getOrderId();
        this.cardNumber = walletDetail.getCardNumber();
        this.useFlag = walletDetail.getUseFlag();
        this.remark = walletDetail.getRemark();
        this.amount = walletDetail.getAmount();
        this.walletAmount = walletDetail.getWalletAmount();
        this.currencyId = walletDetail.getCurrencyId();
        this.currencyName = currency == null ? "" : currency.getName();
        this.currencyCode = currency == null ? "" : currency.getCode();
        this.userId = walletDetail.getUserId();
        this.account = account;
        this.operationUserId = walletDetail.getOperationUserId();
        this.operationUserAccount = operationUserAccount;
        this.requestDate = DateUtil.format(walletDetail.getRequestDate());
        this.hasTransferIn = walletDetail.getHasTransferIn();
    }
}
